import React, { Component } from 'react';
import '../styles/Pcmm.scss'
// import pic from '../assets/1.jpg'
import * as service  from '../api/api'
import { withRouter } from 'react-router-dom';
class Pcmm extends Component {
    constructor(props) {
        super(props)
        this.state = {
            pcmmlist: [
                // { id: 1, name: '李四', sex: '女', age: '18', centent: '张医生经验丰富,医术精湛,用药精准,因为头晕看了数十位大夫都没有起色,在app上找到张主任,吃药后并且好转了' },
                // { id: 2, name: '李四', sex: '女', age: '18', centent: '张医生经验丰富,医术精湛,用药精准,因为头晕看了数十位大夫都没有起色,在app上找到张主任,吃药后并且好转了' },
                // { id: 3, name: '李四', sex: '女', age: '18', centent: '张医生经验丰富,医术精湛,用药精准,因为头晕看了数十位大夫都没有起色,在app上找到张主任,吃药后并且好转了' },
                // { id: 4, name: '李四', sex: '女', age: '18', centent: '张医生经验丰富,医术精湛,用药精准,因为头晕看了数十位大夫都没有起色,在app上找到张主任,吃药后并且好转了' }
            ]
        }
    }
    fanClick(){
        this.props.history.go(-1)
    }
    async componentDidMount(){
        var res2 = await service.pcmmlist({})
        console.log(res2);
        this.setState({pcmmlist:res2.data})
    }
    render() {
        return (
            <div className='pcmm'>
                 <div className="top">
                    <h3 onClick={() => { this.fanClick() }}>&lt; 患者评价</h3>
                </div>
                <h4>共<span>{this.state.pcmmlist.length}</span>个粉丝</h4>
                {
                    this.state.pcmmlist.map((item, index) => {
                        return (
                            <div className="list" key={index}>
                                <div className="left">
                                    <img src={item.pic} alt="" />
                                    <p>{item.name}</p>
                                    <p>{item.sex}</p>
                                    <p>{item.age}岁</p>

                                </div>
                                <div className="right">
                                    <p>{item.centent}</p>
                                </div>
                            </div>
                        )
                    })
                }
            </div>
        );
    }
}

export default withRouter(Pcmm);